﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage/MasterPage.master" AutoEventWireup="true"
    Culture="auto" meta:resourcekey="PageResource1" UICulture="auto" CodeFile="ClientList.aspx.cs"
    Inherits="SystemManage_ClientList" Title="客户列表" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="title">
                <asp:Label ID="lblTitle" runat="server" Text="客户信息列表" meta:resourcekey="lblTitleResource1"></asp:Label></div>
            <table class="add_table" cellspacing="1" cellpadding="3">
                <tr>
                    <td align="right" style="height:50px;">
                        <asp:DropDownList ID="ddlColumnName" runat="server" meta:resourcekey="ddlColumnNameResource1">
                            <%--  <asp:ListItem Text="客户代码" Value="Code" meta:resourcekey="ListItemResource1"></asp:ListItem>--%>
                            <asp:ListItem Text="公司简称" Value="CNShortName" meta:resourcekey="ListItemResource1"></asp:ListItem>
                           <%-- <asp:ListItem Text="公司简称(繁体)" Value="HKShortName" meta:resourcekey="ListItemResource2"></asp:ListItem>
                            <asp:ListItem Text="公司简称(英文)" Value="ENGShortName" meta:resourcekey="ListItemResource3"></asp:ListItem>--%>
                            <asp:ListItem Text="公司名" Value="CNName" meta:resourcekey="ListItemResource4"></asp:ListItem>
                          <%--  <asp:ListItem Text="公司繁体名" Value="HKName" meta:resourcekey="ListItemResource5"></asp:ListItem>
                            <asp:ListItem Text="公司英文名" Value="ENGName" meta:resourcekey="ListItemResource12"></asp:ListItem>--%>
                           <%-- <asp:ListItem Text="公司台头" Value="Title" meta:resourcekey="ListItemResource13"></asp:ListItem>--%>
                           <%-- <asp:ListItem Text="公司台头(繁体)" Value="HKTitle" meta:resourcekey="ListItemResource8"></asp:ListItem>
                            <asp:ListItem Text="公司台头(英文)" Value="ENGTitle" meta:resourcekey="ListItemResource9"></asp:ListItem>--%>
                            <asp:ListItem Text="电子信箱" Value="Email" meta:resourcekey="ListItemResource10"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td style="height:50px;">
                        <asp:TextBox ID="txtName" runat="server" meta:resourcekey="txtNameResource1"></asp:TextBox>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblModel" runat="server" Text="客户类型：" meta:resourcekey="lblModelResource1"></asp:Label>
                    </td>
                    <td style="height:50px;">
                        <asp:DropDownList ID="ddlType" runat="server" meta:resourcekey="ddlTypeResource1" Width="100px">
                        </asp:DropDownList>
                        <cc1:ListSearchExtender ID="ListSearchExtender2" runat="server" TargetControlID="ddlType"
                            PromptCssClass="ListSearchExtenderPrompt">
                        </cc1:ListSearchExtender>
                    </td>
                    <td align="right" style="height:50px;">
                        <asp:Label ID="lblStatus" runat="server" Text="状态：" meta:resourcekey="lblStatusResource1"></asp:Label>
                    </td>
                    <td>
                        <asp:RadioButton ID="radAll" runat="server" Text="全部" Checked="True" GroupName="status"
                            meta:resourcekey="radAllResource1" />
                        <asp:RadioButton ID="radYes" runat="server" Text="有效" GroupName="status" meta:resourcekey="radYesResource1" /><asp:RadioButton
                            ID="radNo" runat="server" Text="失效" GroupName="status" meta:resourcekey="radNoResource1" />
                    </td>
                </tr>
                <tr>
                    <td colspan="6" align="center">
                        <asp:Button ID="btnSearch" runat="server" CssClass="btn" Text="搜索" OnClick="btnSearch_Click"
                            meta:resourcekey="btnSearchResource1" />
                    </td>
                </tr>
            </table>
            <div id="divEntrust" runat="server">
                <div class="list_title">
                    <div class="autoleft">
                        &nbsp;<asp:Label ID="lblTotal" runat="server" meta:resourcekey="lblTotalResource1"></asp:Label>
                        <asp:Label ID="lblRecordFound" runat="server" Text="条记录" meta:resourcekey="lblRecordFoundResource1"></asp:Label>&nbsp;<a
                            href="ClientEdit.aspx"><asp:Label ID="lblClientAdd" runat="server" Text="添加客户" meta:resourcekey="lblClientAddResource1"></asp:Label></a>&nbsp;<a
                            href="ClientBatchImport.aspx"><asp:Label ID="lblImport" runat="server" Text="批量导入"
                                meta:resourcekey="lblImportResource1"></asp:Label></a></div>
                    <div class="autoright">
                        <asp:Label ID="lblPerPageDisplay" runat="server" Text="每页显示：" meta:resourcekey="lblPerPageDisplayResource1"></asp:Label>
                        <asp:DropDownList ID="ddlPages" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlPages_SelectedIndexChanged"
                            meta:resourcekey="ddlPagesResource1">
                            <asp:ListItem Selected="True" Text="10" Value="10" meta:resourcekey="ListItemResource6"></asp:ListItem>
                            <asp:ListItem Text="15" Value="15" meta:resourcekey="ListItemResource7"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                </div>
                <asp:GridView ID="gvClientList" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    Width="100%" AllowSorting="True" OnPageIndexChanging="gvClientList_PageIndexChanging"
                    OnRowCommand="gvClientList_RowCommand" OnSorting="gvClientList_Sorting" OnRowDataBound="gvClientList_RowDataBound"
                    CssClass="tblGridView" meta:resourcekey="gvClientListResource1">
                    <PagerSettings Mode="NumericFirstLast" />
                    <PagerTemplate>
                        <table style="width: 100%">
                            <tr>
                                <td>
                                    <asp:Label ID="lblCurrentPage" runat="server" Text="页次" meta:resourcekey="lblCurrentPageResource1"></asp:Label>:&nbsp;<asp:Label
                                        ID="Label1" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex+1      %>'></asp:Label>/<asp:Label
                                            ID="Label2" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>'></asp:Label>&nbsp;
                                    <asp:Label ID="lblTotalPages" runat="server" Text="总计" meta:resourcekey="lblTotalPangesResource1"></asp:Label>:&nbsp;<asp:Label
                                        ID="Label3" runat="server" Text="<%# ((System.Data.DataView)gvClientList.DataSource).Count %>"></asp:Label>
                                </td>
                                <td align="right">
                                    <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="First"
                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>" Text="首页"></asp:LinkButton>
                                    <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument="Prev" CommandName="Page"
                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>" Text="前页"></asp:LinkButton>
                                    <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="Next"
                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>"
                                        Text="后页"></asp:LinkButton>
                                    <asp:LinkButton ID="LinkButton4" runat="server" CommandArgument="Last" CommandName="Page"
                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>"
                                        Text="尾页"></asp:LinkButton>&nbsp;
                                    <asp:Label ID="lblTurnOn" runat="server" Text="转第" meta:resourcekey="lblTurnTo"></asp:Label><asp:TextBox
                                        ID="txtPages" runat="server" Width="35px"></asp:TextBox>
                                    <asp:Label ID="lblPages2" runat="server" Text="页" meta:resourcekey="lblPages2Resource1"></asp:Label>
                                    <asp:LinkButton ID="lbtnGo" runat="server" Text="提交" OnClick="lbtnGo_Click"></asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </PagerTemplate>
                    <Columns>
                        <asp:TemplateField HeaderText="序号" meta:resourcekey="TemplateFieldResourceRowNum1">
                            <ItemTemplate>
                                <asp:Label ID="lblRowNum" runat="server" Text='<%#(Container as GridViewRow).RowIndex + 1%>'></asp:Label>
                            </ItemTemplate>
                            <ItemStyle Width="5%" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="公司简称" SortExpression="ENGName" meta:resourcekey="TemplateFieldResource2">
                            <ItemTemplate>
                                <asp:Label ID="lblCNName" runat="server" Text='<%# Eval("CNShortName") %>' meta:resourcekey="lblCNNameResource1"></asp:Label>
                                <asp:Label ID="lblENName" runat="server" Text='<%# Eval("ENGShortName") %>' meta:resourcekey="lblENNameResource1"></asp:Label>
                                <asp:Label ID="lblHKName" runat="server" Text='<%# Eval("HKShortName") %>' meta:resourcekey="lblHKNameResource1"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                      <%--  <asp:TemplateField HeaderText="公司台头" SortExpression="ENGTitle" meta:resourcekey="TemplateFieldResourceTitle">
                            <ItemTemplate>
                                <asp:Label ID="lblCNTitle" runat="server" Text='<%# Eval("CNShortName") %>' meta:resourcekey="lblCNTitleResource1"></asp:Label>
                                <asp:Label ID="lblENTitle" runat="server" Text='<%# Eval("ENGTitle") %>' meta:resourcekey="lblENTitleResource1"></asp:Label>
                                <asp:Label ID="lblHKTitle" runat="server" Text='<%# Eval("HKShortName") %>' meta:resourcekey="lblHKTitleResource1"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>--%>
                        <asp:TemplateField HeaderText="电子信箱" SortExpression="Email" meta:resourcekey="TemplateFieldResourceEmail">
                            <ItemTemplate>
                                <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email") %>' meta:resourcekey="lblEmailResource1"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="地点资料" SortExpression="PlaceID" meta:resourcekey="TemplateFieldResourcePlace">
                            <ItemTemplate>
                                <asp:Label ID="lblPlace" runat="server" Text='<%# GetPlace(Eval("PlaceID")) %>' meta:resourcekey="lblEmailResource1"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="业务员" SortExpression="CompanyBP" meta:resourcekey="TemplateFieldResource4">
                            <ItemTemplate>
                                <asp:Label ID="lblType" runat="server" Text='<%# GetUserName(Eval("CompanyBP")) %>' meta:resourcekey="lblTypeResource1"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="状态" SortExpression="Status" meta:resourcekey="TemplateFieldResource5">
                            <ItemTemplate>
                                <asp:Label ID="lblStatus" runat="server" Text='<%# HK2009.Common.StringUtil.GetStatus(Eval("Status")) %>'
                                    meta:resourcekey="lblStatusResource2"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="详情" meta:resourcekey="TemplateFieldResource7">
                            <ItemTemplate>
                                <a href='ClientLook.aspx?ClientID=<%# Eval("PKID") %>'>
                                    <asp:Label ID="lblLook" runat="server" Text="查看" meta:resourcekey="lblLookResource1"></asp:Label></a>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="操作" meta:resourcekey="TemplateFieldResource8">
                            <ItemTemplate>
                                <a href='ClientUpdate.aspx?ClientID=<%# Eval("PKID") %>'>
                                    <asp:Label ID="lblEdit" runat="server" Text="修改" meta:resourcekey="lblEditResource1"></asp:Label></a>
                                <asp:LinkButton ID="lbtnUpdateStatus" runat="server" CommandArgument='<%# Eval("PKID") %>'
                                    CommandName="status" Text="修改状态" OnClientClick='<%#"javascript:return confirm(\""+   Resources.Messages.ConfirmCancelJob  +"\")"%>'
                                    meta:resourcekey="lbtnUpdateStatusResource1"></asp:LinkButton>
                                <asp:LinkButton ID="lbtnDel" runat="server" Text="删除" CommandArgument='<%# Eval("PKID") %>'
                                    OnClientClick='<%#"javascript:return confirm(\""+   Resources.Messages.DelRecord  +"\")"%>' CommandName="Del" meta:resourcekey="lbtnDelResource1"></asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle Width="20%" />
                        </asp:TemplateField>
                    </Columns>
                    <HeaderStyle HorizontalAlign="Center" />
                    <RowStyle HorizontalAlign="Center" />
                </asp:GridView>
            </div>
        </ContentTemplate>
       <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
   <br />
    <div>
    <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Export to Excel" CssClass="btn" meta:resourcekey="Button2Resource2" />
    </div>
</asp:Content>
